/**
 * 设置token
 * @param token
 * @returns
 */
export const setToken = (token: string) => sessionStorage.setItem('token', token);

/**
 * 获取token
 * @param token
 * @returns
 */
export const getToken = () => sessionStorage.getItem('token');

/**
 * 删除token
 * @param token
 * @returns
 */
export const removeToken = () => sessionStorage.removeItem('token');

export const serverUrl = 'http://localhost:3006';

/**
 * 加载图片
 * @param url
 * @returns
 */
export const dalImg = (url: string) => {
  if (url) {
    if (url.startsWith('http')) {
      return url;
    }
    return serverUrl + url;
  }
  return 'https://img2.baidu.com/it/u=1537856357,3914871496&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=786';
};
